<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:76:"/Users/qingyun/php/fruits/public/../application/home/view/commodity_cart.tpl";i:1515028002;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>购物车</title>
</head>
<body>
<script type="text/javascript" src="/static/con/js/jquery.js"></script>
<script type="text/javascript" src="/static/lib/layer/2.4/layer.js"></script>
<link href="/static/common/css/common.css" rel="stylesheet" type="text/css" />
<link href="/static/common/css/style.css" rel="stylesheet" type="text/css" />
<script src="/static/common/js/jquery1.42.min.js" type="text/javascript"></script>
<script src="/static/common/js/common_js.js" type="text/javascript"></script>
<script src="/static/common/js/footer.js" type="text/javascript"></script>
<script src="/static/common/js/jquery.SuperSlide.2.1.1.js" type="text/javascript"></script>
<link href="/static/common/css/page.css" rel="stylesheet" type="text/css" />
<link href="/static/common/css/Narrow.css" rel="stylesheet" type="text/css" />

<!--顶部样式-->
<div id="top">
    <div class="top">
        <div class="Collection"><em></em><a href="#">收藏我们</a></div>
        <div class="hd_top_manu clearfix">
            <ul class="clearfix">
                <?php if(session('?UserXinxi') == false): ?>
                <li class="hd_menu_tit zhuce" data-addclass="hd_menu_hover">欢迎光临本店！<a href="<?php echo url('home/Login/index'); ?>" class="red">[请登录]</a> 新用户<a href="<?php echo url('home/User/add'); ?>" class="red">[免费注册]</a></li>
                <?php else: ?><li class="hd_menu_tit zhuce" data-addclass="hd_menu_hover">欢迎光临本店！<a href="<?php echo url('home/User/userInfo'); ?>" class="red">个人信息</a><a href="<?php echo url('home/User/loginOut'); ?>" class="red">退出登录</a></li>

                <li class="hd_menu_tit" data-addclass="hd_menu_hover"><a href="#">我的订单</a></li>
                <?php endif; ?>

            </ul>
        </div>
    </div>
</div>
<div id="header"  class="header">
    <div class="logo"><a href="#"><img src="/static/common/images/logo.png" /></a></div>
    <div class="Search">
        <p><input name="" type="text"  class="text"/><input name="" type="submit" value="搜索"  class="Search_btn"/></p>

    </div>

</div>
<!--导航栏样式-->
<div id="Menu">
    <div class="Menu_style">

        <!--菜单栏-->
        <div class="Navigation" id="Navigation">
            <ul class="Navigation_name">
                <li><a href="<?php echo url('home/index/index'); ?>">首页</a></li>
                <li><a href="<?php echo url('home/commodity/lists'); ?>">水果</a></li>
            </ul>
        </div>
        <script>$("#Navigation").slide({titCell:".Navigation_name li"});</script>
        <!--购物车-->
    </div>
</div>


<!--正文-->

<div class="zp_Shopping_cart clearfix">
    <div class="Shopping_list">
        <div class="title_name">
            <ul>
                <li class="checkbox">&nbsp;</li>
                <li class="name">商品名称</li>
                <li class="bdj">本店价</li>
                <li class="bdj">&nbsp;&nbsp;</li>
                <li class="sl">购买数量</li>
                <li class="xj">小计</li>
                <LI class="cz">操作</LI>
            </ul>
        </div>
        <div class="shopping">
            <form action="<?php echo url('home/commodity/order'); ?> " method="post">
            <table class="table_list" id="tb">
                <?php foreach($catrInfo as $vo): ?>
                <tr class="tr">
                    <input type="hidden" name="coid[]" value="<?php echo $vo['coid']; ?>">
                    <input type="hidden" name="isca" value="123">
                    <!--<td class="checkbox"><input name="" type="checkbox" value="" /></td>-->
                    <td class="name">
                        <div class="img"><a href="#"><img src="<?php echo $vo['image']; ?>" /></a></div>
                        <div class="p_name"><a href="#"><?php echo $vo['name']; ?></a></div>
                    </td>
                    <td class="bgj sp" ><?php echo $vo['price']; ?></td>
                    <td class="sl">
                        <div class="Numbers">

                            <input id="number" disabled name="number" type="text" value="<?php echo $vo['num']; ?>" class="number_text">

                        </div>
                    </td>
                    <td class="xj" name="xiaojie"><?php echo $vo['price']*$vo['num']; ?></td>
                    <td class="cz">
                        <p><a href="javascript:;" onclick="cartDel(<?php echo $vo['id']; ?>)">删除</a><P>
                    </td>
                </tr>
                <?php endforeach; ?>

            </table>
            <!--<div class="sp_Operation">
                <div class="select-all">
                    <div class="cart-checkbox"><input type="checkbox" checked="checked" id="toggle-checkboxes_down" name="toggle-checkboxes" class="jdcheckbox" clstag="clickcart|keycount|xincart|cart_allCheckDown">全选</div><div class=""><a href="#">删除选中的商品</a></div>
                </div>-->
                <!--结算-->
                <div class="toolbar_right">
                    <div class="p_Total">
                        <span class="text">商品总价：</span><span id="qian" class="price sumPrice">0元</span>
                    </div>

                    <div class="btn">
                        <input name="" type="button" onclick="jump()" value="" class="gouwu_btn" />
                        <input name="" type="submit"  value="" class="submit_btn"/>
                    </div>
                </div>
            </form>
            </div>
        </div>
    </div>

</div>
<div id="bottom">
    <div class="footers">
        <div class="logo"></div>
        <div class="footer_link">


        </div>
    </div>
</div>




<script>
    function cartDel(id){
        layer.confirm('确认要删除吗？',function(index){
            $.ajax({
                type: 'POST',
                url: "<?php echo url('home/commodity/cartDel'); ?>",
                dataType: 'json',
                data:{id:id},
                success: function(data){
                    if(data.status == -1){
                        layer.msg(data.msg,{icon:2,time:1000});
                    }else{
                        layer.msg(data.msg,{icon:1,time:1000},function () {
                            window.location.reload();
                        });
                    }
                },

            });
        });
    }
    function jump() {
        window.location.href = '<?php echo url('home/index/index'); ?>'
    }
    function jumpOrder() {
        window.location.href = '<?php echo url('home/commodity/order'); ?>'
    }
    var sum = 0;

    $("td[name='xiaojie']").each(
        function(){
           sum += parseInt($(this).text());
        }
    );
    $('#qian').text(sum);


</script>
</body>
</html>